package com.hong.spring.annotation;

import com.hong.spring.common.aspectj.PreGreetingAspect;
import com.hong.spring.common.service.impl.NaiveWaiter;
import org.springframework.aop.aspectj.annotation.AspectJProxyFactory;

/**
 * @Auther: csh
 * @Date: 2020/7/15 16:59
 * @Description:
 */
public class AspectJTest {
    public static void main(String[] args) {
        NaiveWaiter naiveWaiter = new NaiveWaiter();
        AspectJProxyFactory factory = new AspectJProxyFactory();
        factory.setTarget(naiveWaiter);
        factory.addAspect(PreGreetingAspect.class);
        NaiveWaiter proxy = factory.getProxy();
        proxy.greeTo("hong");
        proxy.serveTo("hong");
    }
}
